3ca3e4
@@ -219,9 +219,14 @@
private static String createSelectStarQuery(String dataSource) throws IOExceptio
       response.close();
       throw new IOException(org.apache.hadoop.util.StringUtils.stringifyException(e));
     }
-    if (metadataList == null || metadataList.isEmpty()) {
+    if (metadataList == null) {
       throw new IOException("Connected to Druid but could not retrieve datasource information");
     }
+    if (metadataList.isEmpty()) {
+      // There are no rows for that time range, we can submit query as it is
+      return new HiveDruidSplit[] { new HiveDruidSplit(
+              address, DruidStorageHandlerUtils.JSON_MAPPER.writeValueAsString(query), dummyPath) };
+    }
     if (metadataList.size() != 1) {
       throw new IOException("Information about segments should have been merged");
     }
